﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SqlToolkit
{
    interface IDbFactory
    {
        /// <summary>
        /// Provides an ordered list of field names.
        /// </summary>
        string[] Fields { get; }

        /// <summary>
        /// Reads a record from a data reader.
        /// </summary>
        /// <param name="reader">An IDataReader at the record to be accessed.</param>
        /// <returns>A ISqlDataObject.</returns>
        ISqlDataObject Build(System.Data.IDataReader reader);

        /// <summary>
        /// Reads all the records found when executing a given command.
        /// </summary>
        /// <param name="commandText">Command text to be executed.</param>
        /// <returns>A list of ISqlDataObject.</returns>
        List<ISqlDataObject> BuildList(string commandText);

        /// <summary>
        /// Reads all the records found when executing a given command using the provided parameters.
        /// </summary>
        /// <param name="commandText">Command text to be executed.</param>
        /// <param name="commandParamaters">List of of parameters to be used when executing the commandText</param>
        /// <returns>A list of ISqlDataObject.</returns>
        List<ISqlDataObject> BuildList(string commandText, 
            List<System.Data.IDataParameter> commandParamaters);

        /// <summary>
        /// Reads all the records found within a IDataReader.
        /// </summary>
        /// <param name="reader">The IDataReader to be read.</param>
        /// <returns>A list of ISqlDataObject.</returns>
        List<ISqlDataObject> BuildList(System.Data.IDataReader reader);

    }
}
